#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
int isright(char* p) {

	if (((p[1] == 'b') +( p[2] == 'a')==1)&&
		((p[1] == 'b') +( p[3] == 'e')==1)&&
		((p[0]=='c')+(p[1]=='d')==1)&&
		((p[4]=='c')+(p[2]=='d')==1)&&
		((p[3]=='e')+(p[0]=='a')==1))
		return 1;
	return 0;
}
int cheak(const char*p) {
	char ret[5] = { 0 };
	for (int i = 0; i < 5; i++) {
		if (ret[i[p] - 97])
			return 0;
		ret[i[p] - 97] = 1;
	}
}
int main() {
	for (char i = 'a'; i < 'f'; i++) {
		for (char j = 'a'; j < 'f'; j++) {
			for (char k = 'a'; k < 'f'; k++) {
				for (char l = 'a'; l < 'f'; l++) {
					for (char m = 'a'; m < 'f'; m++) {
						char ret[6]= { i,j,k,l,m,'\0' };
						if (isright(ret)&&cheak(ret)){
							printf("%s\n", ret);
						}
					}
				}
			}
		}
	}
	return 0;
}


